<?php 
	$str = "student. a am I";

	$res = ReverseSentence($str);
	echo $res;

	function ReverseSentence($str){
		
		$len = strlen($str);
		$s = '';
		$re = strrpos($str,'.');

		$rev = substr($str,$re+1,$len);

		$str = str_replace($rev,'',$str);

		$res = strrev($rev);

		$res = $res.$str;

		return $res;
	}

 ?>